﻿using Anke.SHManage.Model;
using Anke.SHManage.MSSQLDAL;
using Anke.SHManage.Utility;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Anke.SHManage.BLL
{
    public partial class C_ViolationBLL : BaseBLL<C_Violation>
    {
        private C_ViolationDAL dal = new C_ViolationDAL();

        //查询违章列表   尤浩 2015-11-27
        public object GetViolationList(int page, int rows, string start, string end, string center, string station,string actualCode, string ambulanceNumber,
                                       string place, string driverWorkID, string driverName, E_StatisticsPermisson em, string selfWorkCode, string selfCenterID, string selfStationID)
        {
            return dal.GetViolationList(page, rows, start, end, center, station, actualCode, ambulanceNumber, place,
                                         driverWorkID, driverName, em, selfWorkCode, selfCenterID, selfStationID);
        }
        //取C_Violation表中id最大的一条数据   尤浩 2015-11-27
        public List<C_Violation> GetMaxID()
        {
            string sql = @" select * from C_Violation where id in (select max(id) from C_Violation)";
            return base.DALContext.IC_ViolationDAL.ExcuteSqlToList(sql);
        }
        //根据车牌号码取车辆编码    尤浩 2015-11-27
        public string GetAmbulanceCode(string actualCode)
        {

            StringBuilder sb = new StringBuilder();
            sb.Append(@"
            select AmbulanceCode from C_Ambulance where PlateNumber = '" + actualCode + @"' 
                    ");
            object ds = SqlHelper.ExecuteScalar(SqlHelper.MainConnectionString, CommandType.Text, sb.ToString(), null);

            return ds.ToString();
        }
        //取分中心
        public object GetCenter()
        {
            return dal.GetCenterList();
        }
        //取分中心
        public object GetStationByCenter(int centerID)
        {
            return dal.GetStationByCenterList(centerID);
        }
    }
}
